/**
* 作者: lichuan
* 日期: 2025-07-28 10:49:57
* 备注: 联盟总动员玩家数据
*/
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.server.game.base.AllParam;
import com.motu.monstercity.server.game.commondata.union.UnionActionTaskConstant;
import com.motu.vertx.module.utility.toolset.TimeUtils;
import io.vertx.core.json.JsonObject;

public class UserMobileInfo extends UserMobileInfoModel {
	public UserMobileInfo() {
		super();
	}

	public JsonObject insert() {
		putResetTime(TimeUtils.getCurTime());
		return super.insert();
	}

	public void reset() {
		if (!TimeUtils.isToday(getResetTime())) {
			putAcceptNum(0);
			putHighAcceptNum(0);
			putTotalAcceptNum(0);
			putBuyNum(0);
			putResetTime(TimeUtils.getCurTime());
			update();
		}
	}

	// 重置当前接取任务
	public void resetCurTask(){
		putTaskType(0);
		putTaskId(0);
		update();
	}


	public boolean isMaxComplete(int num){
		return getAcceptNum() >= num;
	}

	public boolean isMaxHighComplete(int num){
		return getHighAcceptNum() >= num;
	}

	// 判断是否超过接取次数
	public boolean isMaxAccept(){
		int limit = getBuyNum() + AllParam.UNIONMOBILE_ACCEP_NUM;
		return getTotalAcceptNum() >= limit;
	}

	// 是否是公共任务
	public boolean isUnionTask(){
		return getTaskType() == UnionActionTaskConstant.TASK_TYPE_3;
	}

	// 判斷是否超过最大购买次数
	public boolean isMaxBuy(){
		return getBuyNum() >= AllParam.UNIONMOBILE_ACCEP_PAY;
	}
}
